cTemplates.Structs module#
Expand for references to
cTemplates.Structs
- class cTemplate[source]#
Bases:
cActionThe base class for all UI elements (Menus, Tools, Sections).It acts as a recursive container that manages the execution order of UI commands.- UICmd()[source]#
- Generates the command string used by the UI system to trigger this action.Format: “python:ExecActionByIdx(index)#FunctionName”
- Run(run_before_list=True)[source]#
- Main execution logic.1. Checks if Enabled.2. Runs pre-requisites (Before list).3. Validates content availability.4. Executes the actual Implementation (creating the menu/tool item).5. Runs post-requisites (After list).
- d_node(cls_to_decorate)[source]#
- Decorator to register a class as a Node in the Node System.Increments the reference count to keep the class definition alive.
Example
@d_nodeclass MyCustomNode(cPy.cNodeSystem.BaseNode):def __init__(self): …
- d_class(cls_to_decorate)[source]#
- Decorator to register base class types in the core registry.Similar to d_node but for general classes.
- d_slot(func)[source]#
- Decorator to register a function as a slot.
Expand for references to
cTemplates.Structs.d_slot
- new_tools_section(section_name, n_action: cTemplate)[source]#
- Executes the C++ binding to create a new tool section in the UI (Left Panel).
- class ToolsSection(section_name=None, parent: cTemplate = None)[source]#
Bases:
cTemplateClass representing a Tool Section (group of tools in the left panel).
- d_tools_section(section_name: str, parent: cTemplate = None)[source]#
- Decorator to define a Tool Section.
Example (from sculptTools.py):
Tools = cTemplate() @d_tools_section("Layers", Tools) def Layers(): coat.tools_item("[extension]MagnifyLayers") # Magnify SL coat.tools_item("[extension]EraseLayers") # Erase SL
- Executes the C++ binding to start a main top-level menu (File, Edit, View…).
- class MainMenu(menu_name=None, parent: cTemplate = None)[source]#
Bases:
cTemplateClass representing a top-level Main Menu.
- Decorator to define a Main Menu item.
Example (from Addons.py):
@d_main_menu("Addons") def AddonsMenu(): coat.menu_item("InstallExtension") coat.menu_item("ListAddons")
- Executes C++ bindings to create a nested submenu.
- Decorator to define a Submenu.
Example (from File.py):
CreateFileMenu = MainMenu("FILE") @d_submenu("Export", CreateFileMenu) def Export(): coat.menu_item("ExportScene") coat.menu_item("ExportSelObject")
- Executes C++ bindings to create a Right-Click Context Menu.
- class RMBMenu(parent: cTemplate = None)[source]#
Bases:
cTemplateClass representing a Right-Click Context Menu.
- Decorator to define a Right-Click Menu logic.
Example (from voxTreeRmb.py):
@d_rmb_menu def VoxTreeRmb(): coat.menu_item("$AutoPick") coat.menu_item("EditProcedural")
- Executes C++ bindings to create a menu separator (section).
- class MenuSection(parent: cTemplate = None)[source]#
Bases:
cTemplateClass representing a section within a menu (usually separated by a line).
- Decorator to define a Menu Section.Adds a separator before the content defined in the decorated function.
Example (from File.py):
@d_menu_section(CreateFileMenu) def S_New(): coat.menu_item("CLEARSCENE") # New coat.menu_hotkey("N", 0, 1, 0) # CTRL+N coat.menu_item("OPEN_FILE") # Open
Expand for references to
cTemplates.Structs.d_menu_section